<div id="user_table">
<table width="100%">
<tr>
<th>Name</th>
<th>email</th>
<th>Groups</th>
<th>Fields</th>
<th>Certificates</th>
</tr>
<% i=1 %>
<% @users.each{|user|%>
<%i = i+1%>
<tr class="<%=i.even? ? "even_row" : "odd_row" %>" > 
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:15px">
	<%= start_form_tag :action=>'approve_all_user_items' %><%= submit_tag 'Approve All'%> <%= end_form_tag %>
	<%=link_to user.last_name+', '+user.first_names, :controller=>'profile', :action=>'view', :id=>user.id%>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:15px">
	<% if not user.email_verified then %><%= start_form_tag :action=>'approve_user_email' %><%= submit_tag 'Approve'%> <%= end_form_tag %><% end %>
	<%= user.email_verified ? "#{user.email}" : "<span class=\"unapproved\">#{user.email}</span>" %>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:15px">
	<% if not user.unapproved_groups.empty? then %><%= start_form_tag :action=>'approve_user_groups' %><%= submit_tag 'Approve'%> <%= end_form_tag %><% end %>
    <%user.unapproved_groups.each{|group|%>
	        <span class="unapproved"><%= group['group_name']%></span>
	 <%}%>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:15px">
	<% if not user.birthdate_approved or not user.physical_approved or not user.biennial_approved or not user.us_citizen_approved %>
		<%= start_form_tag :action=>'approve_user_fields' %><%= submit_tag 'Approve'%> <%= end_form_tag %>
	<% end %>
		<%="<label class=\"unapproved\">Birthdate:</label><br/> #{user.birthdate}<br/>"  unless user.birthdate_approved %>
		<%="<label class=\"unapproved\">Medical Date:</label><br/> #{user.faa_physical_date}<br/>"  unless user.physical_approved %>
		<%="<label class=\"unapproved\">Biennial/Certification Date:</label><br/> #{user.last_biennial_or_certificate_date}<br/>"  unless user.biennial_approved %>
		<%="<label class=\"unapproved\">US Citizen:</label><br/> #{user.is_us_citizen}"  unless user.us_citizen_approved %>
</td>
<td style="vertical-align:top; border-bottom: 1px solid black; padding-bottom:15px">
	<% if not user.unapproved_certificates.empty? %>
		<%= start_form_tag :action=>'approve_user_certificates' %><%= submit_tag 'Approve'%> <%= end_form_tag %>
	<% end %>					
						<table>
							<% user.unapproved_certificates.each{|certificate| %>
								<tr>
									<td style="vertical-align:top;">
										<label class="unapproved"><%= certificate.certificate_category %></label>
									</td>
									<td style="vertical-align:top;">
										<% if certificate.airplane_sel_rating %>
										 <div class="unapproved">Airplane SEL</div>
										<% end %>
										<% if certificate.airplane_mel_rating %>
										 <div class="unapproved">Airplane MEL</div>
										<% end %>
										<% if certificate.helicopter_rating%>
										 <div class="unapproved">Helicopter</div>
										<% end %>
										<% if certificate.instrument_rating%>
										 <div class="unapproved">Instrument</div>
										<% end %>
									</td>
								</tr>
							<% } %>
						</table>
</td>
</tr>   


<% }%>
</table>
</div>